<?php
session_start();
require_once 'includes/config.php';
require_once 'includes/functions.php';
//$proId=$_REQUEST['products'];
//require_once 'includes/class.phpmailer.php';


//$product_owner		= $_REQUEST[''];
$productDesc		= $_REQUEST['pro_description'];
$productCategory	= $_REQUEST['pro_subcategory'];
$productPrice		= $_REQUEST['pro_price'];
//$bargainAmount		= $_REQUEST['price'];

//$productOOwner		= $_REQUEST['posted_by'];

$productName		= $_REQUEST['pro_name'];
$pro_condition		= $_REQUEST['pro_condition'];
$localPickup		= $_REQUEST['localPickup'];
$quantity		= $_REQUEST['pro_quantity'];
//$postedDate		= $_REQUEST['posted_date'];
//$posted_by		= $_REQUEST['posted_by'];
//$bargainDate 		= $_REQUEST['bargain_duration'];
//$sellingType		= $_REQUEST['selling_type'];
$shipping		= $_REQUEST['pro_ship'];
$product_description	= $_REQUEST['pro_description'];
$gift_name		= $_REQUEST['gift_name'];
$gift_description	= $_REQUEST['gift_description'];
//$gift_image		= $_REQUEST['gift_image'];
$return_id		= $_REQUEST['pro_policy'];
$remarks		= $_REQUEST['remarks'];
$commission		= $_REQUEST['pro_commission'];
$bargain_commission_option = $_REQUEST['bargain_commission_option'];
$bargain_price_option	= $_REQUEST['bargain_price_option'];


$gift 			= 0;
if(!empty($gift_name))
{
	$gift = 1;
}

if($shipping!='Free')
	$shipping 	= "$".number_format($_REQUEST['pro_ship'],2);
else
	$shipping 	= "free shipping available";

$sales_tax 		= number_format($_REQUEST['sales_tax'],2);

//$pimage 		= getProductImage($proId,'p');
 //echo $pthumb;
 $productThumbnail	= "images/no_image.gif";
	$productMedium		= "images/no_image.gif";

		  
$catInfo=getCategory($productCategory);
/*
$userId 		= $_SESSION['user_id_sess'];	
$itemId			= $_REQUEST['products'];
$sqlSelItem		= "SELECT * FROM tbl_items WHERE item_id='$itemId'";
$rstSelItem		= mysql_query($sqlSelItem);
$rowSelItem		= mysql_fetch_array($rstSelItem);
$proId			= $rowSelItem['product_id'];	
$product_seller		= $rowSelItem['seller_id'];
$product_owner		= $rowSelItem['owner_id'];
$productDesc		= $rowSelItem['product_description'];
$productCategory	= $rowSelItem['category_id'];
$productPrice		= $rowSelItem['price'];
$bargainAmount		= $rowSelItem['price'];

$sqlSelProd		= "SELECT * FROM tbl_product WHERE product_id='$proId'";
$rstSelProd		= mysql_query($sqlSelProd);
$rowSelProd		= mysql_fetch_array($rstSelProd);
$productOOwner		= $rowSelProd['posted_by'];

$productName		= $rowSelProd['product_name'];
$pro_condition		= $rowSelProd['pro_condition'];
$localPickup		= $rowSelProd['localPickup'];
$quantity		= $rowSelProd['quantity'];
$postedDate		= $rowSelProd['posted_date'];
$posted_by		= $rowSelProd['posted_by'];
$bargainDate 		= $rowSelProd['bargain_duration'];
$sellingType		= $rowSelProd['selling_type'];
$shipping		= $rowSelProd['shipping'];
$product_description	= $rowSelProd['product_description'];
$gift_name		= $rowSelProd['gift_name'];
$gift_description	= $rowSelProd['gift_description'];
$gift_image		= $rowSelProd['gift_image'];
$return_id		= $rowSelProd['return_id'];
$remarks		= $rowSelProd['remarks'];
$commission		= $rowSelProd['commission'];
$bargain_commission_option = $rowSelProd['bargain_commission_option'];
$bargain_price_option	= $rowSelProd['bargain_price_option'];


$gift 			= 0;
if(!empty($gift_name))
{
	$gift = 1;
}

if($shipping!='Free')
	$shipping 	= "$".number_format($rowSelProd['shipping'],2);
else
	$shipping 	= "free shipping available";

$sales_tax 		= number_format($rowSelProd['sales_tax'],2);

$pimage 		= getProductImage($proId,'p');
 //echo $pthumb;
if($pimage['thumb']!="") {
	$productThumbnail	= $pimage['thumb'];
	$productMedium		= $pimage['image'];	
}
else {
	$productThumbnail	= "images/no_image.gif";
	$productMedium		= "images/no_image.gif";
} 
		  
$catInfo=getCategory($productCategory);

$ownerName 	= '';
$user_type 	= '';
$adr = '';
$qry = mysql_query("select business_name,first_name,last_name,user_type,address_line_1,city,state,country,zip from tbl_users where user_id=$product_owner") or die(mysql_error());
$c_qry = mysql_num_rows($qry);
if($c_qry > 0)
{
	$users = mysql_fetch_array($qry);
	$ownerName 	= $users['first_name'];
	$user_type 	= $users['user_type'];
	$address 	= $users['address_line_1'];
	$city		= $users['city'];
	$state		= $users['state'];
	$country	= $users['country'];
	$zip		= $users['zip'];
	$business_name	= $users['business_name'];
	$cou		= get_country_details($country);
	$country_name	= $cou['country_name'];
	$adr 		= $address.", ".$state.",".$country_name;
}
*/
$ss = mysql_query("select googleMapKey from tbl_settings where setting_id=1") or die(mysql_error());
 $tbl_settings = mysql_fetch_array($ss);
 if($tbl_settings) $googleMapKey = $tbl_settings['googleMapKey'];  else $googleMapKey='';
?>
<link href="includes/style.css" rel="stylesheet" type="text/css" />
<script src="<?php echo $base_url?>js/jquery-1.4.4.js" type="text/javascript"></script>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;oe=utf-8&amp;key=<?php echo $googleMapKey; ?>" type="text/javascript"></script>



<style type="text/css">
	span#add-wishlist { color:#0000CC; padding:5px; font-size:12px; }	
</style>

<input type="hidden" id="address_of_seller" value="<?php //echo $adr; ?>" />
<input type="hidden" name="lat" value="" id="lat" />
<input type="hidden" name="lon" value="" id="lon" />
								
<script type="text/javascript">
$(document).ready(function() {

	var geocoder, location1, location2, gDir;
	geocoder = new GClientGeocoder();
	gDir = new GDirections();
	var address_of_seller = $('#address_of_seller').val();
	//alert(address_of_seller);
	geocoder.getLocations(address_of_seller, function (response) {
	if (!response || response.Status.code != 200)
	{
		//alert("Sorry, we were unable to geocode the first address");
	}
	else
	{
		location1 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address};
		//alert(response.Placemark[0].Point.coordinates[1]);
		$('#lat').val(response.Placemark[0].Point.coordinates[1]);
		$('#lon').val(response.Placemark[0].Point.coordinates[0]);
	}
	});
});
</script>
<script language="javascript1.2">

function show_map(pid)
{
  // var pos = $('#more_info_link').position();
  var ntop = ( $(window).height() - $('#map_box').height() ) / 2+$(window).scrollTop();
  var nleft = ( $(window).width() - $('#map_box').width() ) / 2+$(window).scrollLeft();
  
  $('#map_box').css({'left': nleft, 'top':ntop});
  $('#map_box').show();
  var lat = $('#lat'+pid).val();
  var lon = $('#lon'+pid).val();
  //alert(lat+' '+lon);
  initialize(lat,lon);
 
  
}



function initialize(lat,lon) {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map_canvas"));
    map.setCenter(new GLatLng(lat, lon), 13);
    var latlng = new GLatLng(lat,lon);
    map.addOverlay(new GMarker(latlng));
    
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
  }
}

</script>

<table width="100%" border="0">

	<tr>
		<td>
			<div style="width: 950px; float: left; vertical-align: top; margin:15px 0px 5px 0px;">
		
				<div class="mypg_left_out">
					
					
				</div>
				
		
				<?php /*
				<div class="fullbox_out">	
					<strong class="orangehead">Choose Products to Sell</strong>
					<p style="margin: 5px 0px;" class="grey_txt">
						<i>Sell products for business or people and earn a commission. You choose the item with the best price and commission.</i>
					</p>	
				</div>
				      */
				?>
			</div>
	   	</td>
	</tr>

	<tr>
		<td>
			<div class="fulldiv"><h2>Products</h2></div>
	
			<div class="fulldiv">
				<span id='listed-in'>Listed in: <a href='index.php?cat=<?php echo $catInfo['categoryId']; ?>'><?php echo $catInfo['categoryName']; ?></a> >> <a href='index.php?cat=<?php echo $catInfo['subcategoryId']; ?>'><?php echo $catInfo['subcategoryName']; ?></a></span>
				<br style="clear:both;" /><br />
	   
	   
	   
	  
				
	   
					<div class="desc_div">
						<div class="descbox">
							<table width='100%' border='0' align='center' cellspacing='0'>
								<tr>
									<td>
										<div class="fulldiv">
										      <div style="width:300px; float:left;">
												<img src="<?php echo $productMedium; ?>" />				 
										      </div>
										      <div style="width:150px; float:left;">			 
												<img src="<?php echo $productThumbnail; ?>" />
												<div class="fulldiv">
													
												</div>
										      </div>
										</div>
									</td>
								</tr>
			
								<tr>
									<td>
										<div class="fulldiv">
															
											<div class="greytab_out" style="float:left; margin:15px 1px -12px 25px;">
												
												<div class="sbmt_btn" style="padding:5px; height:30px;">
													<b>ADD TO CART</b><img src="images/cart_ico.png" style="margin:0px 0px -3px 10px;" width="20px;" />
												</div>
												
											</div>
											<div class="greytab_out" style="float:left; margin:15px 5px -12px 0px;">
												
												<div class="sbmt_btn" style="padding:5px; height:30px;">
													<span style="float:left; margin-top:7px; font-size:10px">ADD TO WANTED LIST</span>
												</div>
												
											</div>
						
											<div class="ads_out" style="margin:0px 0px 0px 10px;">
												<div class="ads_top"></div>
												<div class="ads_repeat">
														
													
													<div style="margin: 5px 0px;" class="fulldiv">
														<div style="float: left; width: 390px; margin: 0pt 10px;">
															<span style="float: left; width: 290px;">
																<span style="float: left; width: 90px; margin-top: 3px;">
																	Today's Price
																</span> 
																<span style="float: left; width: 105px; text-align: center;">
																	<font style="color: #c43131; font-size: 13px; font-weight: bold;">$<?php echo number_format($productPrice,2); ?></font>
																	<img align="absmiddle" src="images/sale.png" />
																</span>
																<span style="float: left; width: 90px;">
																	<input type="text" name="qnt" id="qnt" class="inputbg" style="width:25px;" value="1" onkeyup="chk_qty(this.value)" onchange="chk_qty(this.value)" /> of <?php echo $quantity;?>
																	<input type="hidden" name="qty" id="qty" value="<?php echo $quantity;?>" />
																</span>
																<script>
																	function chk_qty(a)
																	{
																		var qty = $('#qty').val();
																		if((parseInt(a) > parseInt(qty)) || isNaN(a))
																		{
																			alert("You have entered incorrect quantity, please re-enter");
																			$('#qnt').val('');
																			$('#btnBuy').attr('disabled','disabled');
																		}
																		else
																			$('#btnBuy').attr('disabled','');
																	}
																</script>
															</span>
															<span style="float: left; width: 95px; text-align: right;">
																<input type="button" value="Buy Now" name="btnBuy" id="btnBuy" class="yellow_btn" />
															</span>														
														</div>
													</div>
													
													
													
													
													
													<?php
													if($bargain_price_option==1) {
													?>	
														<form name="frmProductInfo" id="frmProductInfo" method="post">
															<input type="hidden" name="hidBargain" id="hidBargain">
															<div class="fulldiv" style="margin:5px 0px 5px 0px;">	
																<div style="width:100px; float:left; margin:0px 5px 0px 10px;"><strong>Your Offer</strong></div>
																<div style="width:280px; float:left; margin:0px 10px 0px 0px;">
																<input type="text" class="inputbg" style="width:50px;" id="offer_price" name="offer_price" value="<?php echo $offerAmount;?>" />								
																</div>
															</div>
										
															<div class="fulldiv" style="margin:5px 0px 5px 0px;">	
																<div style="width:100px; float:left; margin:0px 5px 0px 10px;"><strong>Add Comment</strong></div>
																<div style="width:280px; float:left; margin:0px 10px 0px 0px;">
																<textarea name="bargain_comment" id="bargain_comment" cols="6" rows="3" style="width:250px;" class="inputbg"></textarea>								
																</div>
															</div>
															
															<div class="fulldiv" style="margin:5px 0px 5px 0px;">	
																<div style="width:100px; float:left; margin:0px 5px 0px 10px;">&nbsp;</div>
																<div style="width:280px; float:left; margin:0px 10px 0px 0px;">
																	<input type="button" value="Make Offer" name="" class="refer_btn" onclick="funBargain();" />
																</div>
															</div>	
														</form>
													<?php
													}
													?>
												</div>
												<!--end : ads_repeat-->
												<div class="ads_bot"></div>
											</div>
											<!--end:ads_out-->
										</div>			
									</td>
								</tr>
			
								<?php /*
								<tr>
									<td> 
										<div class="fulldiv" style="margin:5px 0px 5px 0px;">
									      
											<div style="width:200px; float:left;"><?php  echo checkShippingDetails($sellingType); ?></div>
									      
											<div style="width:180px; float:left;"> 
			  
												<?php if($_SESSION['user_id_sess']=="") { $usr=0; } else { $usr=$_SESSION['user_id_sess'];} ?>
												<?php if($_SESSION['user_id_sess']!=$productOwner && $_SESSION['user_type_sess']!=1) { ?>
													<a href="javascript:void(0);" <?php if($_SESSION['user_type_sess']=="3") {?>onclick="funAddWholeList('<?php echo $itemId; ?>','<?php echo $_SESSION['user_id_sess']; ?>','add-wishlist');"<?php } else {?>onclick="funAddList('<?php echo $itemId; ?>','<?php echo $_SESSION['user_id_sess']; ?>','add-wishlist');" class="yellow_btn" style="height: 22px; margin: 0px 10px 0; padding: 7px 5px 0;"><?php }?>Add to wishlist</a>
												<?php } ?>
												<br /><br /><span id="add-wishlist"></span>
											</div>
										</div>
									</td>
								</tr>
								
								<tr>
									<td>
										<div class="fulldiv" style="margin:5px 0px 5px 0px;">
																		
											<?php
											$sqlList="SELECT * FROM tbl_items WHERE product_id='$proId'";
											$rstList=mysql_query($sqlList);
											$rowList=mysql_num_rows($rstList);
											if($rowList>1)
											{ ?> Price Range: <?php 
												$sqlRange="SELECT MIN(price) as min_price FROM tbl_items WHERE product_id='$proId'";
												$rstRange=mysql_query($sqlRange);
												$rowRange=mysql_fetch_array($rstRange);
												$minp=$rowRange['min_price'];
												$sqlRange="SELECT MAX(price) as max_price FROM tbl_items WHERE product_id='$proId'";
												$rstRange=mysql_query($sqlRange);
												$rowRange=mysql_fetch_array($rstRange);
												$maxp=$rowRange['max_price'];
												?>
												<a href="index.php?spid=<?php echo $proId;?>"><?php echo "$".number_format($minp,2)." - $".number_format($maxp,2);?></a><?php
											} ?>	
										</div>
									</td>
								</tr>
								      */ ?>
								<tr>
									<td>
										<div class="fulldiv" style="margin:5px 0px 5px 0px; height:50px;">
										     <a class="bluelink" href="#" style="text-decoration:none;">Refer a friend to buy this item and make extra commission <img src="images/chat.png" height="40px" width="40px" border="0" style="margin:0px 0px -20px 0px;" /></a>		
										</div>
									</td>
								</tr>
							</table>
						</div>
					</div>
					<!--desc_div-->
	   
	   
					<div class="desc_div" style="margin:0px 0px 0px 5px;">
					
						<div class="descbox">
					
							<table width="100%" border="0" align="center">
						 
							<tr>
								<td>
									<div class="fulldiv">
										<strong class="blue_big"><?php echo "$productName";?></strong>&nbsp;
										<font class="black_big">-&nbsp;<?php echo strtoupper($pro_condition);?></font>				
									</div>
			
									<div class="fulldiv">
										<div style="float:left; width:270px;">
											<p class="grey_txt pro_ptag">
												<i style="float:left;">shipping - <?php echo $shipping;?></i>
											</p>
											<p class="grey_txt pro_ptag">
												<i style="float:left; margin:0px 5px 0px 0px">
													Product Owner:
												</i>
												
												<i style="float:left; color:#000000;">
													<?php //echo $ownerName; ?>&nbsp;
												</i>
												<?php
												$img_t = 'm.png';
												//if($user_type==3)  $img_t = "m.png";  
												//else if($user_type==2) $img_t = "s.png";
												//else if($user_type==5) $img_t = "w.png";
												?>
												<img src="images/<?php echo $img_t;?>" style="float:left; margin:-7px 0px 0px 0px;" />
												
											</p>
											<p class="grey_txt pro_ptag">
												<i style="float:left;">
													
												</i>
												
											</p>
										</div>
										
										<div style="float:right; width:180px; margin:0px 0px 0px 2px; float:left;">
											<p class="grey_txt pro_ptag">
												<i style="float:right;">
													local pick up - <?php if($localPickup==1) echo "available"; else echo "not available"; ?>
												</i>
											</p>
											<p class="grey_txt pro_ptag" style="text-align:right; border:1px solid #898585; padding:3px 0px;">
												<font>
													feedback
												</font>
												<font style="color:#000000;">
													<?php
													echo getfeedback($product_owner);
													?>
												</font>
											</p>
											<p class="pro_ptag">
												<font style="float:right;">
													<a href="seller_store.php?sid=<?php echo $product_seller;?>" class="bluelink">see seller's store</a>
												</font>
											</p>
										</div>	
					
					
									</div>
									
									<div class="fulldiv">
									
										<div class="greytab_out" style="float:left; margin:15px 5px -8px 25px;">
											<div class="greytab_left">&nbsp;</div>
											<div class="greytab_repeat">
												Description
											</div>
											<div class="greytab_right">&nbsp;</div>
										</div>
										
										<div class="ads_out" style="margin:0px 0px 0px 10px;">
											<div class="ads_top"></div>
											<div class="ads_repeat" style="padding:0px 15px 0px 15px; width:404px;">
																		
												<?php echo $product_description;?>					
											</div>
											<div class="ads_bot"></div>
										</div>
					
										<?php
										if($gift==1)
										{
										?>
										<div class="ads_out" style="margin:10px 0px 0px 10px;">
											<div class="ads_top"></div>
											<div class="ads_repeat" style="padding:0px 15px 0px 15px; width:404px;">
												
												<div class="protag_left">
																		
												<p class="pro_ptag grey_big">
												OWNER PROVIDING FREE GIFT</p>
												
												<p class="pro_ptag redtxt">
												<?php echo $gift_name?></p>
					
												<p class="pro_ptag black_big2">
												<?php echo $gift_description?></p>
												
												</div>
												
												<div class="protag_right">
													<?php
													/*if($gift_image!='')
													{
														$temp 	= explode('.',$gift_image);
														$temp1 	= explode('/',$temp[0]);
														$img 	= $temp1[2]."_thumb".$temp[1];
													}
													<img src="products/thumb/<?php //echo $img;?>" />*/
													?>
												</div>
																	
											</div>
											<div class="ads_bot"></div>
										</div>
										<?php
										}
										?>
									</div>
					
									<div class="fulldiv" style="margin:10px 0px 0px 0px;">
					
										<div style="float:left; width:285px;">
											<p class="grey_big pro_ptag">	
												Contact
											</p>
											<p class="grey_txt pro_ptag">
												<i style="float:left;">
													Product Owner:&nbsp;
												</i>
												<i style="float:left; color:#000000;">
													<?php echo $ownerName; ?>&nbsp;
												</i>
											</p>
											<p class="grey_txt pro_ptag">
												<i style="float:left;">
													item location:&nbsp; 
												</i>
												<?php
												/*
												if($user_type==3)
												{
													
													
													$store_addr = $business_name.",<br />".$address.", ".$city."<br />".$state.", ".$country_name; 
												}
												else
												{
													$store_addr = $city.", ".$state; 
												}*/
												?>
												<i style="float:left; color:#000000; float:left;">
													<?php //echo $store_addr; ?>
													<font style="color:#000000;">(<a href="javascript:void(0)" class="bluelink" onclick="show_map(<?php //echo $proId; ?>)">map it</a>)</font>
												</i>
											</p>
											<p class="grey_big pro_ptag">
													Return Policy
											</p>
											<p class="grey_txt pro_ptag">
												<i style="float:left;">
													<?php echo $return_id.", ".$remarks; ?>
												</i>
											</p>
										</div>	
											
										<div style="float:right; width:155px; margin:0px 0px 0px 2px; float:left;">
											<p class="pro_ptag"  style="text-align:right;">
												<a href="#" class="bluelink">Ask Question</a>
												<a class="refer_btn" href="#" style="height: 22px; margin: 10px 0 5px; padding: 7px 5px 7px 5px; text-decoration: none;">Chat</a>
											</p>							
										</div>
									</div>
								</td>
							</tr> 
		             
							</table>
						</div>
						<!--descbox-->
					</div>
					<!--desc_div-->	
	   
					<?php /*
					<div class="desc_div"> 			
						<table width="100%" border="0" align="center">
					       
							<tr>
								
								<td width="53%" valign="top">
									<table  border="0" align="center" width="100%">              
										<tr>
											<td width="93%" height="28" colspan="2" class="uline">
			
												<?php
												
												echo "seller_id".$rowSelItem['seller_id']."<br>";
													echo $userId;
												if($rowSelItem['seller_id'] != $userId)
												{
													
												 ?>
												<table align="center" width="90%" border="0">
													<tr>
														<td height="33" align="center">
															<!--<input type="text" size="7" name="buy_amount">-->
															<input type="button" value="Buy" name="btnBuy" onclick="return addtocart_buy('<?php echo $itemId;?>','<?php echo $productName;?>','<?php echo $productPrice;?>','<?php echo $shipping;?>',1,'<?php echo $sales_tax;?>');">									
														</td>
													</tr>
													<tr>
														<td height="32" align="center"><input type="button" value="Add to Cart" onclick="return addtocart('<?php echo $itemId;?>','<?php echo $productName;?>','<?php echo $productPrice;?>','<?php echo $shipping;?>',1,'<?php echo $sales_tax;?>');"></td>
													</tr>
													<tr>
														<td height="27" align="center"><strong>Bargain</strong></td>
													</tr>
						
													<tr>
														<td align="center">
															<table width="84%"  border="0">
																<tr>
																	<td width="50%" align="center">Asking price </td>
																	<td width="50%" align="center">Your offer </td>
																</tr>
																<tr>
																	<td height="38" align="center"><input type="text" readonly size="7" id="asking_price" name="asking_price" value="<?php echo $bargainAmount; ?>"></td>
																	<td align="center"><input type="text" size="7"  name="offer_price" id="offer_price"></td>
																</tr>
																<tr>
																	<td colspan="2" align="center">Include Comment</td>
																</tr>
																<tr>
																	<td colspan="2" align="center">
																		<textarea name="bargain_comment" id="bargain_comment" style="height:150px; width:250px; "></textarea>
																		<input type="hidden" name="recieverid" value="<?php echo $productOwner;?>"/>
																		<input type="hidden" name="productOOwner" value="<?php echo $productOOwner;?>"/>
																		<input type="hidden" name="pname" value="<?php echo $productName;?>"/>
																	</td>
																</tr>
																<tr>
																	<td colspan="2" align="center"><input type="button" <?php if($userId==$productOwner) { echo " disabled "; } ?> name="btnCommit" value="Commit" onClick="funBargain();"></td>
																</tr>
															</table>
														</td>
													</tr>
												</table>
											<?php 	} ?>
											</td>
										</tr>
									</table>
								</td>
							</tr>          
						</table>
					</div>
					      */
					?>
					
				
				<br /> 
			</div>
			<!--end:full_div-->
			
			<?php
			/*
			<div class="desc_div"> 
				<table width="100%" align="center" border="0">
					<tr>
						<td><strong>Questions and Offers</strong></td>
					</tr>
					<tr>
						<td>
							<?php 
							if(!empty($_POST['hidSellerReply']))
							{ 
								$parentBargain = $_POST['hidSellerReply'];
								if($_POST['hidType']=="add") {								
									$key = $_POST['hidReplyFor'];								
									$askAmt = $_POST['ask_amount'];
									$buyAmt = $_POST['buyer_amount'];
									$selCmt = $_POST['seller_comment'];
									if($askAmt[$key]=="") {
										echo "<div id='err-msg'>Enter asking amount.</div>";
									}
									
									else {
										$sqlAddReply="INSERT INTO tbl_bargain set product_id='$proId',
											asking_amount='$askAmt[$key]', 
											user_id='$userId', 
											parent_id='$parentBargain', 
											user_type='1', 
											offer_amount='$buyAmt[$key]', 
											bargain_type=1,
											comment='$selCmt[$key]', 
											status='reply'";
										$rstAddReply=mysql_query($sqlAddReply);		
										$addReply=mysql_insert_id();								
										if($addReply) { echo "<div id='suc-msg'>Your reply posted successfully.</div>"; }
										else { echo "<div id='err-msg'>Error on placing your reply.</div>"; }		
									}
								}
								elseif($_POST['hidType']=="delete") {
									$sqlDelReply="DELETE FROM tbl_bargain where bargain_id='".$_POST['hidSellerReply']."'";
									$rstDelReply=mysql_query($sqlDelReply);									
									if($rstDelReply) { echo "<div id='suc-msg'>Your reply deleted.</div>"; }
									else { echo "<div id='err-msg'>Error on deleting your reply.</div>"; }
								}	 
							}
							?>
							<form name="frmProductOffer" action="" method="post" id="frmProductOffer">
								<input type="hidden" name="hidSellerReply" id="hidSellerReply">
								<input type="hidden" name="hidReplyFor" id="hidReplyFor">
								<input type="hidden" name="hidType" id="hidType">
								<?php
								include_once("product_offer.php");
								?>
							</form>
						</td>
					</tr>
				</table>
			</div>
			*/
			?>
		</td>
	</tr>
</table>
<div id="map_box" style="position:absolute; width:650px; height:470px; background:#000000; display:none;" align="center">
	<span style="float:right; color:#fff; padding:10px; font-weight:bold; cursor:pointer;" onclick="$('#map_box').hide();">x</span><br />
	<div id="map_canvas" style="width: 600px; height: 400px"></div>
</div>